<!DOCTYPE html>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="spring" uri="http://www.springframework.org/tags" %>
<%@ taglib uri="http://www.springframework.org/tags/form" prefix="form"%>
<jsp:directive.page contentType="text/html" pageEncoding="UTF-8" />

<spring:url value="/rest_book/${curUser.userFName}+${curUser.password}/allbooks" var="rest_book_list"/>
<spring:url value="/rest_user/${curUser.userFName}+${curUser.password}" var="rest_user"/>

<html xmlns:jsp="http://java.sun.com/JSP/Page" >
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Personal ${curUser.userFName}  page</title>
</head>
<body>
<jsp:include page="header.jsp" />
  <div id="centered">
<br />
<c:choose>
		
				<c:when test="${curUser.books ne null}">
					<h2>Personal books list:</h2>
					<br/>
					<a href="${rest_book_list}">Get all user books in xml</a>
					<table id="box-table-a">
		
		<tr>
			<td>Number</td>
			<td>Title</td>
			
			</tr>
			
		<c:forEach var="book" items="${curUser.books}"
				varStatus="rowCounter">
			<spring:url value="/book/${book.title}" var="bookUrl"/>				
			<tr>
				<td>${rowCounter.count}</td>
				<td>${book.title}</td>
				<td><a href="${bookUrl}">Book
						details</a></td>
						
						  <td>
		  <spring:url value="/download/${book.title}" var="load_book"/>
		  <a href="${load_book}">Download</a></td>
		  </td>
						  <td>
		  <spring:url value="/remove_from_user/${book.title}" var="rem_book"/>
		  <a href="${rem_book}">Stop reading</a></td>
		  </td>
				</c:forEach>
		
		</table>
					
				</c:when>
				<c:otherwise>
                    No books here yet
				</c:otherwise>
				
			</c:choose>

<br/>

 <a href="${rest_user}">Get user data</a>
</div>
</body>
</html>